Flash memories are a type of non-volatile memory used by electronic devices. Flash media suffers from a variety of electrically limiting characteristics that limit the useful lifetime of a flash media device. One such characteristic is limited data retention and charge leakage, which can result in (unintentional) changes of logic “1” bits (that are represented by a presence of a charge, for example) to logic “0” bits (that are represented by a relative lack of charge, for example). Another such characteristic is the relatively limited number of erasures for a block of flash that can be performed before the block can no longer be reliably erased and reprogrammed.
Error Detection and Correction Codes can be used to detect and, to a limited extent, correct errors in words that are stored in electronic memories. For example, extra bit cells in a flash memory device can be provided for each stored word. A 2-bit detection /1-bit correction Hamming code can be stored in the extra bit cells to allow detection of up to a 2-bit error in a stored word, and correction of a 1-bit error in a stored word. Thus, in this example, a 1-bit error in a word can be corrected using the Hamming code, whereas a 2-bit error in a word can be detected, but not (reliably) corrected. In typical usage the occurrence of a 1-bit error precedes that of a 2-bit error.
Block management can be used to track the number of erasures for a block (that are used before writing data to the block). The number of erasures can be used to provide “wear-leveling,” where blocks to be erased are cycled such that all available blocks in the flash memory devices are approximately erased the same number of times. (Extra blocks of memory can be used to replace blocks that exceed their number of allowable erasures.)
Block management is also used to mark a block as being “bad” when the block becomes invalid and can no longer be reliably used. Bad blocks may occur at anytime during the lifetime of the part, and once a block goes bad it is usually considered to be always bad. Accordingly, the use of bad blocks is avoided, and the Flash Abstraction Layer accounts for these blocks.